home *** CD-ROM | disk | FTP | other *** search
/ Delphi Informant Complete 1995 - 2000 / Delphi Informant Complete 1995 to 2000.iso / Delphi Informant Magazine Complete Works SOURCE CODE 1995.rar / 1995 / JUL / BT9507 / cursorf.pas < prev    next >
Pascal/Delphi Source File  |  1995-05-19  |  999b  |  49 lines

  1. unit Cursorf;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Memos, ExtCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Memo1: TMemo;
  12.     SetCursorBtn: TButton;
  13.     Button2: TButton;
  14.     Panel1: TPanel;
  15.     procedure SetCursorBtnClick(Sender: TObject);
  16.     procedure Button2Click(Sender: TObject);
  17.   private
  18.     { Private declarations }
  19.   public
  20.     { Public declarations }
  21.   end;
  22.  
  23. var
  24.   Form1: TForm1;
  25.  
  26. implementation
  27.  
  28. {$R *.DFM}
  29.  
  30. procedure TForm1.SetCursorBtnClick(Sender: TObject);
  31. begin
  32.   { Move the cursor to line 3 column 5. }
  33.   ActiveControl := Memo1;
  34.   MemoCursorTo(Memo1, 2, 5);
  35. end;
  36.  
  37. procedure TForm1.Button2Click(Sender: TObject);
  38. var
  39.   MemoLine,
  40.   MemoCol:        Integer;
  41. begin
  42.   { Display the memo's cursor position. }
  43.   GetMemoLineCol(Memo1, MemoLine, MemoCol);
  44.   Panel1.Caption := 'Line: ' + IntToStr(MemoLine) +
  45.                     ' Col: ' + IntToStr(MemoCol);
  46. end;
  47.  
  48. end.
  49.